package com.tongji.housediy.view.component3D
{
	import alternativa.engine3d.materials.TextureMaterial;
	
	import flash.display.BitmapData;
	import flash.display.BlendMode;
	import flash.display.GradientType;
	import flash.display.Shape;
	import flash.geom.Matrix;

	/**
	 * 
	 * @author xuxunjia
	 * 
	 */	
	public class CeilingMaterial extends TextureMaterial
	{
		private var matr:Matrix;
		private var spot:Shape;
		
		public function CeilingMaterial(width:Number, height:Number, wallBitmap:BitmapData)
		{	
			this.texture = new BitmapData(width, height, false);
			
			super(texture);
			
			matr = new Matrix();
			matr.createGradientBox(1.6 * width, 1.6 * height, 0, -0.3 * width , -0.3 * height);
			
			spot = new Shape();
			spot.graphics.clear();
			spot.graphics.beginBitmapFill(wallBitmap);
			spot.graphics.drawRect(0, 0, width, height);
			
			spot.graphics.clear();
			spot.graphics.beginGradientFill(GradientType.RADIAL, [0xffffff, 0x000000], [1, 1], [0, 255], matr);
			spot.graphics.drawRect(0, 0, width, height);
			texture.draw(spot,null,null,BlendMode.MULTIPLY);
		}
	}
}